package com.bnlr.lrparking.appui.web;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

import com.bnlr.lrparking.R;
import com.bnlr.lrparking.base.BaseActivity;
import com.bnlr.lrparking.constant.Urls;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 分期办理流程
 */
public class CarWebActivity extends BaseActivity {
    @BindView(R.id.car_web)
    WebView webView;
    @BindView(R.id.tv_nav_title)
    TextView tvTitle;
    private int from;
    public static final String WEB_TAG = "CarWebActivity";
    private Unbinder unbinder;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_car_web);
        unbinder = ButterKnife.bind(this);
        from = getIntent().getIntExtra(WEB_TAG,0);
        if (from == 0) {
            tvTitle.setText("分期办理流程");
        }
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        //关闭缓存，解决回退异常的问题
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.loadUrl(Urls.URL_STAGE_EXAMPLE);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }
}
